Skip to content

VDF extension#454

Merged
henry2004y merged 8 commits intomasterfrom
vdf-extension
Feb 8, 2026
Merged

VDF extension#454
henry2004y merged 8 commits intomasterfrom
vdf-extension

Conversation

@henry2004y
Copy link
Owner

Move VelocityDistributionFunctions into an new extension.

@gemini-code-assist
Copy link

Summary of Changes

Hello @henry2004y, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors how velocity distribution functions are integrated into the TestParticle package. By moving the VelocityDistributionFunctions dependency into a dedicated Julia extension, the core package becomes more lightweight and modular. This change ensures that the VDF functionality is only loaded when explicitly needed, while maintaining a seamless user experience and improving overall package architecture.

Highlights

  • VDF Extension: The VelocityDistributionFunctions package has been refactored into a new Julia extension, TestParticleVDFExt, improving modularity and reducing the core package's direct dependencies.
  • Dependency Management: The VelocityDistributionFunctions dependency was moved from direct dependencies to weak dependencies in Project.toml, and the new extension TestParticleVDFExt was added.
  • VDF Function Definitions: The convenience constructors for Maxwellian, BiMaxwellian, Kappa, and BiKappa are now defined within the TestParticleVDFExt extension, with src/sampler.jl updated to declare these functions for extension-based implementation.
  • Precompilation Optimization: VDF-related precompilation logic has been moved from src/precompile.jl into the new TestParticleVDFExt extension, ensuring efficient loading.
  • Test Environment Cleanup: The Meshes dependency has been removed from the test environment (test/Project.toml, test/runtests.jl, test/test_density.jl), streamlining the testing setup.
  • Test File Updates: Test files (test/runtests.jl, test/test_distributions.jl) were updated to correctly import the VDF types from TestParticle, which are now provided via the extension.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Project.toml
    • Moved VelocityDistributionFunctions from direct dependencies to weakdeps.
    • Added TestParticleVDFExt to the extensions section.
  • ext/TestParticleVDFExt.jl
    • Added a new extension file.
    • Defined wrapper functions for Maxwellian, BiMaxwellian, Kappa, and BiKappa.
    • Included @setup_workload and @compile_workload for VDF types.
  • src/precompile.jl
    • Removed precompilation calls for Maxwellian and BiMaxwellian.
  • src/sampler.jl
    • Removed direct import of VelocityDistributionFunctions.
    • Removed the explicit definitions of VDF wrapper functions, replacing them with function Foo end declarations.
  • test/Project.toml
    • Removed Meshes from test dependencies.
  • test/runtests.jl
    • Removed using Meshes statement.
    • Added using VelocityDistributionFunctions.
    • Added import TestParticle: Maxwellian, BiMaxwellian, Kappa, BiKappa.
  • test/test_density.jl
    • Removed using Meshes statement.
  • test/test_distributions.jl
    • Added import TestParticle: Maxwellian, BiMaxwellian, Kappa, BiKappa.
Activity
  • No specific activity (comments, reviews, or progress updates) has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly refactors the code to use a package extension for VelocityDistributionFunctions, which is a great improvement following modern Julia practices. My review includes a few suggestions for the new extension file to improve maintainability by making dependencies on the parent package's internal API more explicit. Overall, the changes are solid and well-implemented.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2026

Benchmark Results (Julia v1)

Time benchmarks
master 2a5c7ae... master / 2a5c7ae...
interpolation/cartesian 0.12 ± 0.001 μs 0.12 ± 0.01 μs 1 ± 0.084
interpolation/spherical 0.421 ± 0.01 μs 0.411 ± 0.001 μs 1.02 ± 0.024
interpolation/time-dependent 4.07 ± 3.2 μs 4.19 ± 3.1 μs 0.972 ± 1.1
trace/GC/DiffEq Vern6 5.68 ± 1.4 μs 5.71 ± 1.5 μs 0.995 ± 0.35
trace/GC/Native RK4 0.136 ± 0.00016 s 0.137 ± 0.00013 s 0.989 ± 0.0015
trace/GC/Native RK45 3.36 ± 0.12 μs 3.34 ± 0.13 μs 1.01 ± 0.053
trace/Hybrid/Sheared 3.45 ± 0.08 μs 3.42 ± 0.07 μs 1.01 ± 0.031
trace/analytic field/in place 0.0589 ± 0.035 ms 0.0573 ± 0.036 ms 1.03 ± 0.88
trace/analytic field/in place relativistic 0.0803 ± 0.034 ms 0.077 ± 0.033 ms 1.04 ± 0.63
trace/analytic field/out of place 0.0448 ± 0.033 ms 0.0449 ± 0.034 ms 0.999 ± 1.1
trace/normalized/out of place 15.7 ± 8.9 μs 15.9 ± 9.8 μs 0.989 ± 0.83
trace/numerical field/Adaptive Boris 4.2 ± 0.057 ms 4.21 ± 0.19 ms 0.997 ± 0.047
trace/numerical field/Boris 7.37 ± 0.09 μs 7.48 ± 0.11 μs 0.985 ± 0.019
trace/numerical field/Boris ensemble 14.7 ± 0.14 μs 14.9 ± 0.16 μs 0.988 ± 0.014
trace/numerical field/Boris kernel 9.49 ± 0.13 μs 9.55 ± 0.14 μs 0.994 ± 0.02
trace/numerical field/Boris with fields 8.07 ± 0.08 μs 8 ± 0.069 μs 1.01 ± 0.013
trace/numerical field/Multistep Boris 11 ± 0.07 μs 10.9 ± 0.07 μs 1 ± 0.0091
trace/numerical field/in place 27.4 ± 4.7 μs 27.2 ± 4.8 μs 1.01 ± 0.25
trace/numerical field/out of place 18.9 ± 4.7 μs 18.9 ± 4.7 μs 1 ± 0.35
trace/time-dependent field/in place 0.136 ± 0.0035 ms 0.133 ± 0.0034 ms 1.02 ± 0.037
trace/time-dependent field/out of place 0.108 ± 0.0032 ms 0.106 ± 0.0037 ms 1.01 ± 0.046
time_to_load 2.19 ± 0.051 s 2.04 ± 0.0048 s 1.07 ± 0.025
Memory benchmarks
master 2a5c7ae... master / 2a5c7ae...
interpolation/cartesian 2 allocs: 0.234 kB 2 allocs: 0.234 kB 1
interpolation/spherical 2 allocs: 0.203 kB 2 allocs: 0.203 kB 1
interpolation/time-dependent 0.044 k allocs: 9.62 kB 0.044 k allocs: 9.62 kB 1
trace/GC/DiffEq Vern6 0.177 k allocs: 12.2 kB 0.177 k allocs: 12.2 kB 1
trace/GC/Native RK4 13 allocs: 0.382 MB 13 allocs: 0.382 MB 1
trace/GC/Native RK45 16 allocs: 2.44 kB 16 allocs: 2.44 kB 1
trace/Hybrid/Sheared 8 allocs: 2.98 kB 8 allocs: 2.98 kB 1
trace/analytic field/in place 2.07 k allocs: 0.0883 MB 2.07 k allocs: 0.0883 MB 1
trace/analytic field/in place relativistic 2.07 k allocs: 0.0883 MB 2.07 k allocs: 0.0883 MB 1
trace/analytic field/out of place 2.03 k allocs: 0.0866 MB 2.03 k allocs: 0.0866 MB 1
trace/normalized/out of place 0.753 k allocs: 0.0321 MB 0.753 k allocs: 0.0321 MB 1
trace/numerical field/Adaptive Boris 27 allocs: 1.5 MB 27 allocs: 1.5 MB 1
trace/numerical field/Boris 6 allocs: 1.16 kB 6 allocs: 1.16 kB 1
trace/numerical field/Boris ensemble 10 allocs: 2.28 kB 10 allocs: 2.28 kB 1
trace/numerical field/Boris kernel 0.038 k allocs: 2.12 kB 0.038 k allocs: 2.12 kB 1
trace/numerical field/Boris with fields 6 allocs: 1.52 kB 6 allocs: 1.52 kB 1
trace/numerical field/Multistep Boris 6 allocs: 1.16 kB 6 allocs: 1.16 kB 1
trace/numerical field/in place 0.432 k allocs: 20.8 kB 0.432 k allocs: 20.8 kB 1
trace/numerical field/out of place 0.393 k allocs: 18.6 kB 0.393 k allocs: 18.6 kB 1
trace/time-dependent field/in place 3.97 k allocs: 0.177 MB 3.97 k allocs: 0.177 MB 1
trace/time-dependent field/out of place 3.93 k allocs: 0.175 MB 3.93 k allocs: 0.175 MB 1
time_to_load 0.145 k allocs: 11 kB 0.145 k allocs: 11 kB 1

@codecov
Copy link

codecov bot commented Feb 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.23%. Comparing base (bce0cb1) to head (2a5c7ae).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #454      +/-   ##
==========================================
+ Coverage   80.93%   81.23%   +0.29%     
==========================================
  Files          20       21       +1     
  Lines        2025     2025              
==========================================
+ Hits         1639     1645       +6     
+ Misses        386      380       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@henry2004y henry2004y merged commit 5fb4303 into master Feb 8, 2026
9 checks passed
@henry2004y henry2004y deleted the vdf-extension branch February 8, 2026 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments